<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>绘制文本</title>
</head>
<body>
  <canvas id="ctx" width="1000" height="1000" style="background-color: #eee;"></canvas>
</body>
</html>

<script>
const canvas = document.querySelector('#ctx')
const ctx = canvas.getContext('2d')

ctx.font = "48px serif"

ctx.fillText('hello worldzb', 10, 40)
ctx.strokeText("Hello world", 100, 100);

</script>